package com.huifaapp.mall.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.huifaapp.mall.R;
import com.huifaapp.mall.activity.AftersaleActivity;

/**
 * Created by mac on 2017/12/12.
 */

public class AftersaleApplicationAdapter extends RecyclerView.Adapter <AftersaleApplicationAdapter.MyViewHolder> {
    private Context context;
    private Button btaftersale;

    public AftersaleApplicationAdapter(Context context) {
        this.context = context;
    }

    @Override
    public AftersaleApplicationAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.aftersale_item, null);
        AftersaleApplicationAdapter.MyViewHolder myViewHolder = new AftersaleApplicationAdapter.MyViewHolder(view);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(AftersaleApplicationAdapter.MyViewHolder holder, int position) {

    }

    @Override
    public int getItemCount() {
        return 1;
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {

        public MyViewHolder(View itemView) {
            super(itemView);
            btaftersale = (Button) itemView.findViewById(R.id.bt_aftersale);
            btaftersale.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(context, AftersaleActivity.class);
                    context.startActivity(intent);
                }
            });
        }
    }

    {
    }

    public interface OkItck{
        void okck(View view,int position);

    }
    private OkItck okItck;

    public void setOkItck(OkItck okItck){
        this.okItck = okItck;
    }
}